<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<?php
require_once "../php/objetos/Email.php";
require_once "../php/objetos/Usuario.php";
session_start();
if (!array_key_exists("userId", $_SESSION) && $_SESSION["userId"] == NULL) {
    header("Location: ../index.php");
}
$userId = $_SESSION["userId"];
$email = $_SESSION["email"];
unset($_SESSION["email"]);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../css/style.css"/>
        <title>WEBEMAIL</title>
    </head>
    <body>
        <div id="header">
            <img src="../css/imagens/header.jpg" />
            <div id="logout">
                Bem Vindo, 
                <?php
                echo $userId->getNome();
                ?>

                <a href="../php/Logout.php"><img src="../css/imagens/exit.png" height="20" width="20" /></a>
            </div>
        </div>
        <div id="menu">
            <h4>Menu</h4>
            <ul>
                <li><a href="principal.php">Caixa de Entrada</a></li>
                <li><a href="lixeira.php">Lixo</a></li>
                <li><a href="rascunho.php"><img alt="seta" src="../css/imagens/btn_seta_2.png" class="iconSeta"/>Rascunho</a></li>
                <li><a href="itensEnviados.php">Itens Enviados</a></li>
            </ul>
        </div>
        <div id="content">
            <?php if ($email != null) { ?>
                <h4>Rascunho</h4>
                <form method="post" action="../php/EnviarEmail.php">
                    <div id="cabecalhoEmail">
                        <table>
                            <td>
                            <tr>
                                <td>Destinatário:</td>
                                <td><input id="destinatario" name="destinatario" type="text" size="130" value="<?php echo $email->getDestinatario(); ?>"/></td>
                            </tr>
                            <tr>
                                <td>Assunto:</td>
                                <td><input id="assunto" name="assunto" type="text" size="130" value="<?php echo $email->getAssunto(); ?>"/></td>
                            </tr>
                            </td>
                        </table>

                    </div>
                    <div>
                        <textarea id="conteudo" name="conteudo" style="margin-left: 10px;" cols="129" rows="15" ><?php echo $email->getConteudo(); ?></textarea>
                    </div>
                    
                    <input type="submit" value="Enviar" />
                </form>                
            <?php
            } else {
                header("Location: principal.php");
            }
            ?>
        </div>
        <div id="footer">
            @WebMail Todos Direitos Reservados
        </div>
    </body>
</html>
